function getCartCount() {
  let cart = wx.getStorageSync('cart') || [];
  // let cart = JSON.parse(cartStr)
  let res = cart.length;
  if (res > 0) {
    wx.setTabBarBadge({
      index: 2,
      text: res + "",
    })
    var app = getApp();
    app.globalData.totalCartCount = res;
  } else {
    wx.removeTabBarBadge({
      index: 2
    })
    var app = getApp();
    app.globalData.totalCartCount = 0;
  }
}
exports.getCartCount = getCartCount;